Merged
Conversation
Resolves the two deferred Copilot findings on PR #20 review #4176623587. Pure cleanup — zero behavior change. **Copilot #4 — RGBA-plane bounds-check helper extraction.** Added two `pub(super) fn` helpers in `src/sinker/mixed/mod.rs`: - `rgba_plane_row_slice(buf, one_plane_start, one_plane_end, w, h)` — centralises the `one_plane_end.checked_mul(4)? + one_plane_start * 4 + slice` pattern with `GeometryOverflow` reporting. - `rgb_row_buf_or_scratch(rgb, rgb_scratch, ...)` — picks RGB plane slice when attached, else grows the scratch buffer; same overflow handling. Refactored every `MixedSinker<F>::process` impl across the 6 child modules (`planar_8bit` / `semi_planar_8bit` / `subsampled_4_*_high_bit` / `bayer`) to call the helpers instead of inlining the bounds-check + slice math: - Pattern A (RGB row buf-or-scratch): 37 substitutions across all 33 process impls (wired + unwired families). - Pattern B (standalone RGBA branch): 9 substitutions in the wired families (Yuv420p / Yuv422p / Yuv444p / Yuv440p / Nv12 / Nv16 / Nv21 / Nv24 / Nv42). - Pattern C (Strategy-A RGBA expand fan-out): 9 substitutions in the same wired families. **Copilot #2 — `_impl` visibility tightening.** Dropped `pub(crate)` from 23 of 24 `*_to_rgb_or_rgba_row[_impl]<...>` functions in `src/row/scalar.rs` and the 5 SIMD backends. The single exception kept `pub(crate)`: `scalar::yuv_420_to_rgb_or_rgba_row` — called by all 5 SIMD backends as the scalar tail handler (verified by grep across `src/row/arch/*.rs`). **Diff:** 13 files changed, +434 / -1134 (net -700 lines). All helpers and the visibility tightening shrink the production-facing surface without touching any wire-level behaviour. **Verified locally on aarch64 macOS:** - 479 lib tests pass (unchanged). - 1 doctest passes. - `cargo check --lib --target wasm32-unknown-unknown`: clean. - `cargo check --lib --target x86_64-unknown-linux-gnu`: clean. - `cargo clippy --lib --tests`: 0 warnings. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Refactors MixedSinker row-processing implementations to reduce duplicated buffer-slicing logic and tightens internal kernel helper visibility in row backends.
Changes:
- Introduces shared helpers in
src/sinker/mixed/mod.rsfor selecting RGB row output buffers and slicing RGBA row ranges. - Updates multiple
MixedSinker<F>::processimplementations to use the new helpers instead of repeated slicing/overflow-check patterns. - Narrows visibility of several internal
*_to_rgb_or_rgba_*helpers in scalar/SIMD row implementations frompub(crate)to module-private.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/sinker/mixed/mod.rs | Adds rgba_plane_row_slice and rgb_row_buf_or_scratch helpers to centralize duplicated logic. |
| src/sinker/mixed/planar_8bit.rs | Replaces inline RGB/RGBA slicing logic with shared helpers. |
| src/sinker/mixed/semi_planar_8bit.rs | Replaces inline RGB/RGBA slicing logic with shared helpers for NV* formats. |
| src/sinker/mixed/subsampled_4_2_0_high_bit.rs | Uses rgb_row_buf_or_scratch for RGB row selection (but adds an unused import). |
| src/sinker/mixed/subsampled_4_2_2_high_bit.rs | Uses rgb_row_buf_or_scratch for RGB row selection (but adds an unused import). |
| src/sinker/mixed/subsampled_4_4_4_high_bit.rs | Uses rgb_row_buf_or_scratch for RGB row selection (but adds an unused import). |
| src/sinker/mixed/bayer.rs | Uses rgb_row_buf_or_scratch for RGB row selection (but adds an unused import). |
| src/row/scalar.rs | Makes shared scalar kernel helpers module-private. |
| src/row/arch/neon.rs | Makes shared SIMD kernel helpers module-private. |
| src/row/arch/wasm_simd128.rs | Makes shared SIMD kernel helpers module-private. |
| src/row/arch/x86_sse41.rs | Makes shared SIMD kernel helpers module-private. |
| src/row/arch/x86_avx2.rs | Makes shared SIMD kernel helpers module-private. |
| src/row/arch/x86_avx512.rs | Makes shared SIMD kernel helpers module-private. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.